<div class="breadcrumbs" id="breadcrumbs" >
    <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
            jQuery(function($) {
                $("#footer").load("main/footer.html");
            });
        </script>
    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="#index">首页</a>
        </li>
        <li class="active">预定管理</li>

    </ul>
</div><!-- /.main-content -->

<div class="page-content">

    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
        `<div>
            选择日期：
            <input  type="text" ng-model="startDate"  id="startDate" name="effectDate"  /><i class='icon-calendar bigger-110'></i>
            <input style="margin-left:10px;border-radius:10px;"  ng-click="searchTime()" type="button" class="btn btn-primary btn-sm"   id="search" name="search" value="查询"  />

          <!--  场地名称：
            <input style="margin-left:10px"  type="text" ng-model="siteName"  id="siteName" name="siteName"  />
            <input style="margin-left:10px;border-radius:10px;"  ng-click="searchSite()" type="button" class="btn btn-primary btn-sm"   id="searchSite" name="searchSite" value="查询"  />

            <br/>
            <br/>-->

            <input style="margin-left:10px;border-radius:10px;"  ng-click="fixedSite()" type="button" class="btn btn-primary btn-sm"   id="searchSite" name="searchSite" value="固定场地"  />

            <input style="margin-left:20px;border-radius:10px;"  ng-click="todayNow()" type="button" class="btn btn-primary btn-sm"   id="todayNow" name="todayNow" value="今天"  />
            <input style="border-radius:10px;"  ng-click="prwDay()" type="button" class="btn btn-primary btn-sm"   id="prwDay" name="prwDay" value="上一天"  />
            <input  disabled="disabled" type="text"    id="nowDay" name="nowDay"  value="{{todayTime | date:'yyyy-MM-dd'}}"/>
            <input style="border-radius:10px;"  ng-click="nextDay()" type="button" class="btn btn-primary btn-sm"   id="nextDay" name="nextDay" value="下一天"  />

        </div>
        <br/>
            <div class="container" id="divMain">
                <table id="tableUser" class="table table-bordered table-responsive"  >
                    <tr>
                        <th></th>
                        <th ng-repeat="site in siteTypeList">{{site.placeName}}
                            <button ng-if="isAdd" ng-click="reserve(site)">预定</button>
                        </th>
                    </tr>
                    <tr ng-repeat="time in siteTime">
                        <td id="time_{{ time.timeKey }}">{{time.timeDate }}</td>
                        <td  class="bagGreen"  ng-repeat="site in siteTypeList" id="site_{{ site.placeKey }}_{{ time.timeKey }}"></td>
                    </tr>
                </table>
            </div>
            <!-- PAGE CONTENT ENDS -->
        </div>
    </div>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">预定场地</h4>
                </div>
                <form ng-submit="siteInfoUpdate(siteInfo)"  class="form-horizontal" role="form" id="stmUserForm">

                    <div class="modal-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="placeName">场地名称</label>
                            <div class="col-sm-3">
                                	<span  class="block input-icon input-icon-right">
                                      <input type="text" disabled="disabled"   ng-model="siteInfo.placeName" id="placeName" name="placeName" class="form-control" value="{{ siteInfo.placeName }}"/>
                                </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="placeType">场地类型</label>
                            <div class="col-sm-3">
								<span  class="block input-icon input-icon-right">
                                      <input type="text" disabled="disabled"   ng-model="siteInfo.placeType" id="placeType" name="placeType" class="form-control" value="{{ siteInfo.placeType }}"/>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"
                                   for="startTime"> 选择预定时间段</label>
                            <div class="col-sm-3">
                                <input  type="text" ng-model="startTime"  id="startTime" name="startTime"  />
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="endTime"> 至</label>
                            <div  class="col-sm-3">
                                <input  type="text" ng-blur="endD();" ng-model="endTime"   id="endTime" name="endTime"  />
                            </div>

                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="vipName">客户名称</label>
                            <div class="col-sm-3">
                                	<span  class="block input-icon input-icon-right">
                                      <input type="text"    ng-model="siteInfo.vipName" id="vipName" name="vipName" class="form-control" value="{{ siteInfo.vipName }}"/>
                                </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="price">实收现金</label>
                            <div class="col-sm-2">
                             <span required  class="block input-icon input-icon-right">
                                 <input type="text"   ng-model="siteInfo.price" id="price" name="price" class="form-control" />
                             </span>
                            </div>
                            <div class="col-sm-3">
                               <span class="block input-icon input-icon-right">
                                  <select id="payMethod" name="payMethod" ng-model="siteInfo.payMethod" class="form-control"
                                          ng-options="pay for pay in payMethod"></select>
                                   </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="operatorNum">操作员</label>
                            <div class="col-sm-4">
										<span class="block input-icon input-icon-right" >
                                            <select id="operatorNum" name="operatorNum" ng-model="siteInfo.operatorNum.usrKey" class="form-control"
                                                    ng-options="stmUsr.usrKey as stmUsr.usrName for stmUsr in stmUsrList">
                                        </select>
                                        </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="cardId"> 证件号码</label>
                            <div class="col-sm-4">
                                	<span  class="block input-icon input-icon-right">
                                      <input type="text"   ng-model="siteInfo.cardId" id="cardId" name="cardId" class="form-control" value="{{ siteInfo.cardId }}"/>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="cardType">证件类型</label>
                            <div class="col-sm-4">
                                <span class="block input-icon input-icon-right" >
                                            <select id="cardType" name="cardType" ng-model="siteInfo.cardType" class="form-control"
                                                    ng-options="card for card in cardTypeLst">
                                        </select>
                                        </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="phone"> 联系电话</label>
                            <div class="col-sm-4">
                                	<span  class="block input-icon input-icon-right">
                                      <input type="text"   ng-model="siteInfo.phone" id="phone" name="phone" class="form-control" value="{{ siteInfo.phone }}"/>

                                </span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="vipNum">会员卡号</label>
                            <div class="col-sm-4">
                              <span  class="block input-icon input-icon-right">
                                      <input type="text"   ng-model="siteInfo.vipNum" id="vipNum" name="vipNum" class="form-control" value="{{ siteInfo.vipNum }}"/>

                                </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="vipType">会员类型
                            </label>
                            <div class="col-sm-4">
                                <input required  id="vipType" name="vipType" type="radio" ng-model="siteInfo.vipType" value="会员" />会员
                                <input required  id="vipType1" name="vipType" type="radio" ng-model="siteInfo.vipType" value="非会员" />非会员
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="remarks">备注说明
                            </label>
                            <div class="col-sm-10">
										<textarea id="remarks" ng-disabled="isDisabled" style="resize: none" name="remarks" ng-maxlength="200"
                                                  class="form-control" required  ng-model="siteInfo.remarks">{{ siteInfo.remarks }}</textarea>
                            </div>


                        </div>
                    </div>
                    <div class="modal-footer">
                        <span style="float:left">单价:</span><span style="float:left">{{ tollStandard }}</span>
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="submit" class="btn btn-primary">保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>


    <div class="modal fade" id="myModalPay" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalPayMent">会员付款</h4>
                </div>
                <form ng-submit="payMentUpdate(payMentInfo)"  class="form-horizontal" role="form" >
                    <input type="text" hidden="hidden"  id="placeKey" name="placeKey" />
                    <input type="text" hidden="hidden"  id="phone1" name="phone1" />
                    <input type="text" hidden="hidden"  id="scheduledDate" name="scheduledDate" />
                    <input type="text" hidden="hidden"  id="state" name="state" />

                    <div class="modal-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="vipPayNum">会员卡号</label>
                            <div class="col-sm-3">
                              <span  class="block input-icon input-icon-right">
                                      <input type="text" disabled="disabled"  ng-model="payMentInfo.vipNum" id="vipPayNum" name="vipPayNum" class="form-control" value="{{ payMentInfo.vipNum }}"/>

                                </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="payPrice">实收现金</label>
                            <div class="col-sm-2">
                             <span required  class="block input-icon input-icon-right">
                                 <input type="text"   required ng-model="payMentInfo.price" id="payPrice" name="payPrice" class="form-control" />
                             </span>
                            </div>
                            <div class="col-sm-3">
                               <span class="block input-icon input-icon-right">
                                  <select id="payMentMethod" name="payMentMethod" ng-model="payMentInfo.payMethod" class="form-control"
                                          ng-options="pay for pay in payMethod"></select>
                                   </span>
                            </div>
                        </div>

                        <div class="form-group">

                            <label class="col-sm-2 control-label no-padding-right"
                                   for="timePrice">应付余额
                            </label>
                            <div class="col-sm-4">
                              <span  class="block input-icon input-icon-right">
                                      <input type="text" disabled="disabled"  ng-model="payMentInfo.timePrice" id="timePrice" name="timePrice" class="form-control" value="{{ payMentInfo.timePrice }}"/>

                                </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="operatorPayNum">操作员</label>
                            <div class="col-sm-4">
										<span class="block input-icon input-icon-right" >
                                            <select id="operatorPayNum" name="operatorPayNum" ng-model="payMentInfo.operatorNum.usrKey" class="form-control"
                                                    ng-options="stmUsr.usrKey as stmUsr.usrName for stmUsr in stmUsrList">
                                        </select>
                                        </span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="vipPayName">会员名称</label>
                            <div class="col-sm-4">
                              <span  class="block input-icon input-icon-right">
                                      <input type="text" disabled="disabled"  ng-model="payMentInfo.vipName" id="vipPayName" name="vipPayName" class="form-control" value="{{ payMentInfo.vipName }}"/>
                                </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="vipPayType">会员类型
                            </label>
                            <div class="col-sm-4">
                                <input required  id="vipPayType" name="vipPayType" type="radio" ng-model="payMentInfo.vipType" value="会员" />会员
                                <input required  id="vipPayType2" name="vipPayType" type="radio" ng-model="payMentInfo.vipType" value="非会员" />非会员
                            </div>
                        </div>


                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="submit" class="btn btn-primary">保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>


    <div class="modal fade" id="fixedModal" tabindex="1" role="dialog" aria-labelledby="fixedModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="fixedModalLabel">固定场地</h4>
                </div>
                <form ng-submit="fixedUpdate(fixedSiteInfo)"  class="form-horizontal" role="form" >

                    <div class="modal-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="placeFixedName">场地名称</label>
                            <div class="col-sm-3">
                                <select id="placeFixedName" name="payMethod" ng-model="fixedSiteInfo.placeKey" class="form-control"
                                        ng-options="siteType.placeKey as siteType.placeName for siteType in siteTypeList"></select>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="startFixedDate">开始时间</label>
                            <div class="col-sm-4">
                                <input  type="text" ng-model="startFixedDate"  id="startFixedDate" name="startFixedDate"  />
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="endFixedDate">结束时间</label>
                            <div  class="col-sm-4">
                                <input  type="text"  ng-model="endFixedDate"   id="endFixedDate" name="endFixedDate"  />
                            </div>

                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="startFixedTime">开始时段</label>
                            <div class="col-sm-4">
                                <input  type="text" ng-model="startFixedTime"  id="startFixedTime" name="startFixedTime"  />
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="endFixedTime"> 结束时段</label>
                            <div  class="col-sm-4">
                                <input  type="text" ng-blur="fixedEndTime();" ng-model="endFixedTime"   id="endFixedTime" name="endFixedTime"  />
                            </div>

                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="vipFixedName">客户名称</label>
                            <div class="col-sm-4">
                                	<span  class="block input-icon input-icon-right">
                                      <input type="text"    ng-model="fixedSiteInfo.vipName" id="vipFixedName" name="vipFixedName" class="form-control" value="{{ fixedSiteInfo.vipName }}"/>
                                </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="operatorFixedNum">操作员</label>
                            <div class="col-sm-4">
										<span class="block input-icon input-icon-right" >
                                            <select id="operatorFixedNum" name="operatorNum" ng-model="fixedSiteInfo.operatorNum.usrKey" class="form-control"
                                                    ng-options="stmUsr.usrKey as stmUsr.usrName for stmUsr in stmUsrList">
                                        </select>
                                        </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="vipFixedNum">会员卡号</label>
                            <div class="col-sm-4">
                              <span  class="block input-icon input-icon-right">
                                      <input type="text" ng-blur="checkVip(fixedSiteInfo.vipNum)"  ng-model="fixedSiteInfo.vipNum" id="vipFixedNum" name="vipFixedNum" class="form-control" value="{{ fixedSiteInfo.vipNum }}"/>

                                </span>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="fixedPhone"> 联系电话</label>
                            <div class="col-sm-4">
                                	<span  class="block input-icon input-icon-right">
                                      <input type="text" ng-blur="checkPhone()"  ng-model="fixedSiteInfo.phone" id="fixedPhone" name="fixedPhone" class="form-control" value="{{ fixedSiteInfo.phone }}"/>

                                </span>
                            </div>
                        </div>

                        <div class="form-group">


                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right"
                                   for="remarksFixed">备注说明
                            </label>
                            <div class="col-sm-10">
										<textarea id="remarksFixed"  style="resize: none" name="remarksFixed" ng-maxlength="200"
                                                  class="form-control" required  ng-model="fixedSiteInfo.remarks">{{ fixedSiteInfo.remarks }}</textarea>
                            </div>


                        </div>
                    </div>
                    <div class="modal-footer">
                        <span style="float:left">单价:</span><span style="float:left">{{ totalFixedStandard }}</span>
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="submit" class="btn btn-primary">保存</button>
                    </div>

                    </div>
                </form>
            </div>
        </div>
    </div>

    <!-- /.col -->
<script>
     //$('#tableUser').tableMergeCells();
      $( "#startDate" ).fdatepicker({
			format: 'yyyy-mm-dd',
	  });
		 $( "#startFixedDate" ).fdatepicker({
			format: 'yyyy-mm-dd',
		});
		 $( "#endFixedDate" ).fdatepicker({
			format: 'yyyy-mm-dd',
		});
			$("#startTime").hunterTimePicker();
			$("#endTime").hunterTimePicker();
			$("#startFixedTime").hunterTimePicker();
			$("#endFixedTime").hunterTimePicker();
</script>
</div>